package cn.tm.ms.nerver.restful;

import java.util.HashMap;
import java.util.Map;

import cn.tm.ms.nerver.restful.annotation.Restful;
import cn.tm.ms.nerver.restful.annotation.HttpPath;
import cn.tm.ms.nerver.restful.servlet.Request;
import cn.tm.ms.nerver.restful.servlet.Response;

@Restful
@HttpPath("/demo")
public class DemoAPI {
	
	@HttpPath("/helloString")
	public void helloString(Request request, Response response) {
		DemoModel data = request.getData(DemoModel.class);
		response.setData("hello "+data.getName());
	}
	
	@HttpPath("/helloMap")
	public void helloMap(Request request, Response response) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("string", "hello world");
		map.put("int", 999);
		map.put("Object", request);
		response.setData(map);
	}
	
}
